package cn.yuanqiao.system.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.annotation.IdAnnotation;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.exception.ServiceException;
import cn.yuanqiao.common.utils.SecurityUtils;
import cn.yuanqiao.common.utils.StringUtils;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;

/**
 * 常用下载对象 YQCYXZ
 *
 * @author sy
 * @date 2023-09-14
 */
public class YqCyxz extends BaseEntity {
    private static final long serialVersionUID = 1L;

    private final String BIGTABLENAME = "_YQCYXZ";

    public YqCyxz() {
        String userCode = SecurityUtils.getTenantCode();
        if (StringUtils.isEmpty(userCode)) {
            throw new ServiceException("TenantCode is null");
//            this.tableName = "YQCYXZ";
        } else {
            this.tableName = userCode.toUpperCase() + BIGTABLENAME;
//            this.tableName = "YQCYXZ";
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /**
     * $column.columnComment
     */
    @IdAnnotation
    private Long id;

    /**
     * 文件名
     */
    @Excel(name = "文件名")
    private String fileName;

    /**
     * 文件大小
     */
    @Excel(name = "文件大小")
    private String fileSize;

    /**
     * 文件路径
     */
    @Excel(name = "文件路径")
    private String filePath;

    /**
     * 上传人ID
     */
    @Excel(name = "上传人ID")
    private Long uploaderId;

    /**
     * 上传人姓名
     */
    @Excel(name = "上传人姓名")
    private String uploaderName;

    /**
     * 发布范围
     */
    @Excel(name = "发布范围")
    private String releaseScope;

    /**
     * 发布时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date releaseTime;

    /**
     * 是否已发布
     */
    @Excel(name = "是否已发布")
    private Integer isRelease;

    /**
     * 创建人ID
     */
    @Excel(name = "创建人ID")
    private Long creatorId;

    /**
     * 最后修改人
     */
    @Excel(name = "最后修改人")
    private Long LASTUPDATER;

    /**
     * 最后修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "最后修改时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastupdateTime;

    /**
     * 当前登录人
     */
    @Excel(name = "当前登录人")
    private Long userId;

    private String mj;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileSize(String fileSize) {
        this.fileSize = fileSize;
    }

    public String getFileSize() {
        return fileSize;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setUploaderId(Long uploaderId) {
        this.uploaderId = uploaderId;
    }

    public Long getUploaderId() {
        return uploaderId;
    }

    public void setUploaderName(String uploaderName) {
        this.uploaderName = uploaderName;
    }

    public String getUploaderName() {
        return uploaderName;
    }

    public void setReleaseScope(String releaseScope) {
        this.releaseScope = releaseScope;
    }

    public String getReleaseScope() {
        return releaseScope;
    }

    public void setReleaseTime(Date releaseTime) {
        this.releaseTime = releaseTime;
    }

    public Date getReleaseTime() {
        return releaseTime;
    }

    public void setIsRelease(Integer isRelease) {
        this.isRelease = isRelease;
    }

    public Integer getIsRelease() {
        return isRelease;
    }

    public void setCreatorId(Long creatorId) {
        this.creatorId = creatorId;
    }

    public Long getCreatorId() {
        return creatorId;
    }

    public void setLASTUPDATER(Long LASTUPDATER) {
        this.LASTUPDATER = LASTUPDATER;
    }

    public Long getLASTUPDATER() {
        return LASTUPDATER;
    }

    public void setLastupdateTime(Date lastupdateTime) {
        this.lastupdateTime = lastupdateTime;
    }

    public Date getLastupdateTime() {
        return lastupdateTime;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getMj() {
        return mj;
    }

    public void setMj(String mj) {
        this.mj = mj;
    }

    @Override
    public String toString() {
        return "YqCyxz{" +
                "id=" + id +
                ", fileName='" + fileName + '\'' +
                ", fileSize='" + fileSize + '\'' +
                ", filePath='" + filePath + '\'' +
                ", uploaderId=" + uploaderId +
                ", uploaderName='" + uploaderName + '\'' +
                ", releaseScope='" + releaseScope + '\'' +
                ", releaseTime=" + releaseTime +
                ", isRelease=" + isRelease +
                ", creatorId=" + creatorId +
                ", LASTUPDATER=" + LASTUPDATER +
                ", lastupdateTime=" + lastupdateTime +
                ", userId=" + userId +
                ", mj='" + mj + '\'' +
                '}';
    }
}
